drop function if exists GET_PARAM;
go

create function RSBUGT.GET_PARAM(param_name long varchar, parse_str long varchar)
returns long varchar
begin
    declare ret long varchar;

    set param_name = concat(param_name, '="');

    if (locate(param_name, parse_str) > 0) then
        set ret = right(parse_str, length(parse_str) - locate(param_name, parse_str) - length(param_name) + 1);
        if (locate('";', ret) > 0) then
            set ret = left(ret, locate('";', ret) - 1);
        else
            set ret = '';
        end if;
    else
        set ret = '';
    end if;

    return ret;
end;
go
